/*
 * Copyright 2009 Max Kugland
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.splink.deepsplink.navigation.command {
	import org.splink.deepsplink.navigation.INavigation;

	/**
	 * Enables clients to register and unregister <code>INavigation</code>
	 * instances and provides a <code>gotoPage</code> method which enables clients
	 * to request deepsplink to change to another <code>Page</code>.
	 * 
	 * @see org.splink.deepsplink.navigation.INavigation
	 * 
	 * @author Max Kugland
	 */
	public interface INavigationCommand {
		/**
		 * @copy org.splink.deepsplink.deeplink.IDeeplinkController#registerNavigation
		 * 
		 * @param navigation the <code>INavigation</code> to register
		 */
		function registerNavigation(navigation : INavigation) : void;

		/**
		 * @copy org.splink.deepsplink.deeplink.IDeeplinkController#unregisterNavigation
		 * 
		 * @param navigation the <code>INavigation</code> to unregister
		 */
		function unregisterNavigation(navigation : INavigation) : void;

		/**
		 * Instructs the framework to change from the current to the page 
		 * with the given id.
		 * 
		 * @param pageId die id of the page to show
		 * @param pageParams an optional <code>Array</code> of <code>PageParameter</code>
		 * instances 
		 */
		function gotoPage(pageId : String, pageParams : Array = null) : void;
		
		/**
		 * @return the id of the current page
		 */
		function get currentPageId() : String;
		
		/**
		 * @return an <code>Array</code> of the <code>PageParameter</code>s which 
		 * are currently active.
		 */
		function get currentPageParameters() : Array;
		
		/**
		 * Navigates to the previous page if there is a previous page.
		 * @return whether the page change was successfull or not
		 */
		function back() : Boolean;

	}
}
